#ifndef __IV_CALCULATOR_H__
#define __IV_CALCULATOR_H__

#include <stdio.h>
#include <stdlib.h>
#include <ctime>
#include <cmath>
#include <vector>
#include <string>
#include <limits>

typedef struct Option {
  char type;
  float strike;
  float bid;
  float ask;
  int year;
  int month;
  int day;
} option;

typedef struct Request {
  int type;
  std::string symbol;
  float strike;
  int year;
  int month;
} request;
extern "C" {
class IVCalculator {
 private:
  int numOptions;

  // shared info for the options
  float cudaHostSpot;
  float cudaHostRisk;

  // current time setting
  int cudaHostYear;
  int cudaHostMonth;
  int cudaHostDay;

  // cudaHostMemory
  option * cudaHostOptions;
  float * cudaHostVolatility;
  float * cudaHostPrice;

  // cudaDeviceMemory
  option * cudaDeviceOptions;
  //  float * cudaDeviceVolatility;
  //  float * cudaDevicePrice;

 public:
  IVCalculator();

  ~IVCalculator();

  void loadOptionData(std::vector<option> * opts,int n, float s,
		      float r, int cy, int cm, int cd);

  void setup();

  void  calculateIV();

  float * getResultIV();


};
}


#endif
